package com.hankol.community.api

import com.baselibrary.base.BasicListBean
import com.baselibrary.bean.*
import com.baselibrary.net.result.HttpResult
import com.hankol.community.bean.*
import com.okhttp.comment.CommentBean
import io.reactivex.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

interface CommunityApi {
    //根据用户idsStr获取用户信息(id 头像 昵称)
    @FormUrlEncoded
    @POST("web/user/userInfoList")
     fun reqUidsGetUserInfo(@Field("token") token: String, @Field("uids") uids: String): Observable<HttpResult<List<BatchUserBean>>>

    /**
     * 搜索好友
     *分享给好友，选择好友页面
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("friends/getFriendsList")
    fun reqSearchFriend(@Field("token") token: String?, @Field("keyWord") keyWord: String?): Observable<HttpResult<List<FriendListBean>?>?>?

    /**
     * 推荐视频列表
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("timeline/timelineVideo")
    fun reqVideoDetails(@Field("token") token: String?, @Field("cursor") cursor: String?, @Field("currentId") currentId: Long, @Field("btype") btype: Long, @Field("bid") bid: String?, @Field("deviceId") deviceId: String?): Observable<HttpResult<VideoReadBean.DataBeanX?>?>?

    /**
     * 推荐视频列表
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("timeline/timelineVideo")
    fun reqVideoDetails(@Field("token") token: String?, @Field("cursor") cursor: String?, @Field("currentId") currentId: Long, @Field("btype") btype: Long, @Field("deviceId") deviceId: String?): Observable<HttpResult<VideoReadBean.DataBeanX?>?>?
    //视频页 列表
    @FormUrlEncoded
    @POST("timeline/timelineVideo")
    fun reqVideoPageList(@Field("cursor") cursor: String?): Observable<HttpResult<VideoReadBean.DataBeanX?>?>?

    /**
     * 标记推荐视频已读
     */
    @FormUrlEncoded
    @POST("history/add")
    fun reqVideoHistoryAdd(@Field("token") token: String?, @Field("busiId") busiId: Long?, @Field("busiType") busiType: Long): Observable<HttpResult<Any?>?>?

    /**
     * 动态详情
     *
     * @return
     */
    @FormUrlEncoded
    @POST("timeline/load")
    fun reqDynamicDetails(@Field("token") token: String, @Field("id") id: Long): Observable<HttpResult<TimelineInfoData.ClientTimeline>>

    /**
     * 详情评论
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/comment/v1.19.2/getPagerWithTop")
    fun reqCommentList(@Field("token") token: String, @Field("size") size: Int, @Field("type") type: Int, @Field("typeId") typeId: Long, @Field("page") page: Int, @Field("pid") pid: Long, @Field("topCommentId") topCommentId: Long): Observable<HttpResult<CommentBean.DataBean>>


    /**
     * 首页Banner和热门话题
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("homePage/hotTagsAndBanner")
    fun requestBannerAndHotTags(@Field("token") token: String): Observable<HttpResult<HotBannerData.DataDTO?>>

    /**
     * 频道内Banner和热门话题
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("tag/tagCategoryBanner")
    fun requestChannelBannerAndHotTags(@Field("token") token: String, @Field("tagCategoryId") tagCategoryId: Int): Observable<HttpResult<HotBannerData.DataDTO?>>

    /**
     * 话题详情
     *
     * @return
     */
    @FormUrlEncoded
    @POST("tag/tagDetail")
    fun requestTopicDetail(@Field("token") token: String, @Field("tid") tid: String): Observable<HttpResult<TopicDetailsBean.DataBean>>

    /**
     *话题详情活跃优质用户
     *
     * @return
     */
    @FormUrlEncoded
    @POST("tag/primeUserList")
    fun requestTopicGoodUser(@Field("token") token: String, @Field("page") page: Int, @Field("size") size: Int, @Field("tid") tid: String): Observable<HttpResult<GoodUserBean>>

    /**
     * 预约直播
     *
     * @return
     */
    @FormUrlEncoded
    @POST("userLiveRoomPool/add")
    fun requestSubscribeLive(@Field("token") token: String, @Field("lid") tid: String): Observable<HttpResult<String>>

    /**
     * 取消预约直播
     *
     * @return
     */
    @FormUrlEncoded
    @POST("userLiveRoomPool/delete")
    fun requestCancelSubscribeLive(@Field("token") token: String, @Field("lid") tid: String): Observable<HttpResult<String>>

    /**
     * 某个类型下的制定话题
     *type 0选择话题 1全部话题
     * @return
     */
    @FormUrlEncoded
    @POST("tag/tagListByTagCategoryId")
    fun reqSearchTopic(@Field("token") token: String, @Field("tagCategoryId") tagCategoryId: Long, @Field("size") size: Long, @Field("type") type: Int): Observable<HttpResult<List<ReleaseTopicBean.DataBean>>>


    /**
     * 获取频道列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("tag/v1.26.2/getList")
    fun requestChannelList(@Field("token") token: String): Observable<HttpResult<List<HomeChannelBean>>>

    /**
     * 专栏分页列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/channel/v1.19.3/getPager4loop")
    fun reqColumnListNewData(@Field("token") token: String, @Field("page") page: Int, @Field("size") size: Long): Observable<HttpResult<BasicListBean<SquareSpecialColumnBean>>>


    /**
     * 讲坛分类  分页列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("webCourseTopic/v1.19.3/getPager")
    fun reqForumClassifyList(@Field("token") token: String, @Field("page") page: Int, @Field("size") size: Long): Observable<HttpResult<BasicListBean<ForumClassifyListBean>>>

    /**
     * 某个分类下 的 讲坛  分页列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("forum/v1.19.3/getPager")
    fun reqForumList(@Field("token") token: String, @Field("ctId") ctId: Int, @Field("page") page: Int, @Field("size") size: Long): Observable<HttpResult<BasicListBean<ForumListBean>>>

    /**
     *查询专栏下文章列表page-size
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/article/v1.19.3/getPager")
    fun reqColumnDetailList(@Field("token") token: String, @Field("cid") cid: Int, @Field("page") page: Int, @Field("size") size: Long): Observable<HttpResult<BasicListBean<ColumnDetailsListBean>>>

    /**
     * 讲坛主页信息
     *
     * @return
     */
    @FormUrlEncoded
    @POST("forum/v1.19.3/loadDetail")
    fun reqPulpitHome(@Field("token") token: String, @Field("id") id: Long): Observable<HttpResult<PulpitInfoBean>>

    /**
     * 获取讲坛视频列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("forumCourse/v1.19.3/getPager")
    fun reqPulpitList(@Field("token") token: String, @Field("fid") fid: Long, @Field("size") size: Long): Observable<HttpResult<BasicListBean<PulpitListBean>>>

    /**
     * 获取课程视频详情
     *
     * @return
     */
    @FormUrlEncoded
    @POST("forumCourse/v1.19.3/loadDetail")
    fun reqPulCourse(@Field("token") token: String, @Field("fcid") fcid: Long): Observable<HttpResult<PulCourseBean>>

    /**
     *  解锁讲坛
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/integralMall/payCourse")
    fun reqUnlockPulpit(@Field("token") token: String, @Field("fid") fid: Long): Observable<HttpResult<Any>>

    /**
     * 关注页动态列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/getFocusTimelinePager")
    fun reqFollowDynamicList(
            @Field("token") token: String,
            @Field("page") page: Int,
            @Field("size") size: Long
    ): Observable<HttpResult<FollowDynamicBean.DataBeanX>>


    /**
     *文章详情
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/article/v1.19.3/loadDetail")
    fun reqArticleDetail(
            @Field("token") token: String,
            @Field("aid") aid: Long
    ): Observable<HttpResult<ArticleDetailBean>>


    /**
     *文章详情 阅读数+1
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/article/addReadNum")
    fun reqArticleDetailRedNumPlus(
            @Field("token") token: String,
            @Field("aid") aid: Long
    ): Observable<HttpResult<Boolean>>

    /**
     *专栏详情
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/channel/v1.19.3/loadDetail")
    fun reqColumnDetailData(
            @Field("token") token: String,
            @Field("id") id: Int
    ): Observable<HttpResult<ColumnDetailBean>>

    /**
     *讲坛分类详情
     *
     * @return
     */
    @FormUrlEncoded
    @POST("webCourseTopic/v1.19.3/detail")
    fun reqForumClassDetail(
            @Field("token") token: String,
            @Field("id") id: Int
    ): Observable<HttpResult<ForumClassifyInfoBean>>

    /**
     * 关注页关注人列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/focusTop9List")
    fun reqFollowUsers(@Field("token") token: String): Observable<HttpResult<FollowUserBean>>

    /**
     * 关注页所有关注人列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("focusFans/getFans")
    fun reqMyFollow(
            @Field("token") token: String,
            @Field("keyWord") keyWord: String,
            @Field("type") type: Int,
            @Field("page") page: Int,
            @Field("size") size: Long
    ): Observable<HttpResult<BasicListBean<FollowUsersBeanItem>>>

    /**
     *  已经有关注人时的推荐列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/hasFocusrecommendUserTop10")
    fun reqInterestUsers(@Field("token") token: String): Observable<HttpResult<List<InterestUserBean>>>

    /**
     *  还没有关注任何人时的推荐列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/noFocusRecommendUserTop50")
    fun reqRecommendUsers(@Field("token") token: String, @Field("index") index: Int, @Field("size") size: Int): Observable<HttpResult<List<RecommendUserBean>>>

    /**
     *  添加不在推荐的人
     *
     * @return
     */
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/blacklist/add")
    fun reqNoCareUsers(@Field("token") token: String, @Field("targetUid") targetUid: Int): Observable<HttpResult<Boolean>>

    //进行关注
    @FormUrlEncoded
    @POST("focusFans/add")
    fun reqAddFollow(
            @Field("token") token: String,
            @Field("type") type: Long,
            @Field("thirdId") thirdId: Long
    ): Observable<HttpResult<String>>

    //进行关注
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/add")
    fun reqAddFollow2(
            @Field("token") token: String,
            @Field("type") type: Long,
            @Field("thirdId") thirdId: Long
    ): Observable<HttpResult<FollowSuccBean>>

    //进行关注
    @FormUrlEncoded
    @POST("focusFans/del")
    fun reqCancelFollow(
            @Field("token") token: String,
            @Field("type") type: Long,
            @Field("thirdId") thirdId: Long
    ): Observable<HttpResult<String>>

    //取消关注
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/del")
    fun reqCancelFollow2(
            @Field("token") token: String,
            @Field("type") type: Long,
            @Field("thirdId") thirdId: Long
    ): Observable<HttpResult<FollowSuccBean>>

    /**
     * 课程视频学习进度保存
     */
    @FormUrlEncoded
    @POST("forumCourse/v1.19.3/saveProgress")
    fun reqSaveProgress(
            @Field("token") token: String,
            @Field("fcId") fcId: Long,
            @Field("offset") offset: Long,
            @Field("progress") progress: Long
    ): Observable<HttpResult<Boolean>>

    /**
     *
     */
    @FormUrlEncoded
    @POST("tag/recommendTag")
    fun reqDefSearchTopics(@Field("token") token: String): Observable<HttpResult<List<ReleaseTopicBean.DataBean>>>
    /**
     *
     */
    @FormUrlEncoded
    @POST("/forumCourse/addWatchNumber")
    fun reqStatistics(@Field("token") token: String,@Field("id") courId: Long): Observable<HttpResult<Any>>

    /**
     * 话题分类列表 获取选择话题、全部话题
     *type 0选择话题 1全部话题
     * @return
     */
    @FormUrlEncoded
    @POST("tag/v1.0/getTagCategoryList")
    fun requestTopicTagList(@Field("type") type: Int): Observable<HttpResult<List<TopicClassifyBean>>>

    /**
     * 根据话题名搜索话题
     *type 0选择话题 1全部话题
     * @return
     */
    @FormUrlEncoded
    @POST("tag/searchTags")
    fun requestSearchTopic(@Field("searchKey") searchKey: String,@Field("type") type: Int): Observable<HttpResult<List<SearchTopicBean>>>

    /**
     * 首页改版数据
     *
     * @return
     */
    @POST("homePage/v1.0/getHomePageNew")
    fun requestHomePageData(): Observable<HttpResult<HomePageBean>>

}